<!--财务明细-->
<meta charset="utf-8"/>
<div class="row">
  <div class="col-xs-12">
    <div class="row">
      <div class="col-xs-12">
        <div class="visible-lg-block" style="margin-top:2px">
          <table class="no-border" style="display:inline">
            <tr height="50px">
              <td permission='financial_details_btn_listData' style="padding-right:6px;display:none">
                收款人
              </td>
              <td permission='financial_details_btn_listData' style="display:none">
                <input type="text" id="key_payee_account" class="form-control search-query" placeholder="输入收款人账号" style="width:140px"/>
              </td>
              <td permission='financial_details_btn_listData' style="padding:0 6px;display:none" class="hidden-480">
                购买人
              </td>
              <td permission='financial_details_btn_listData' style="display:none" class="hidden-480">
                <input type="text" id="key_buyer_account" class="form-control search-query" placeholder="输入购买人账号" style="width:140px"/>
              </td>
              <td permission='financial_details_btn_listData' style="padding:0 6px;display:none" class="hidden-480">
                交易单号
              </td>
              <td permission='financial_details_btn_listData' style="display:none" class="hidden-480">
                <input type="text" id="key_transaction_id" class="form-control search-query" placeholder="输入交易单号" style="width:140px"/>
              </td>
              <td permission='financial_details_btn_listData' style="padding-left:6px;display:none" class="hidden-480">
                订单号
              </td>
              <td permission='financial_details_btn_listData' style="display:none" class="hidden-480">
                <input type="text" id="key_out_trade_no" class="form-control search-query" placeholder="输入订单号" style="width:140px"/>
              </td>
              <td permission='financial_details_btn_listData' style="padding-left:6px;display:none" class="hidden-480">
                支付类型
              </td>
              <td colspan="2" permission='financial_details_btn_listData' style="display:none" class="hidden-480">
                <span class="input-group-btn">
                  <button data-toggle="dropdown" class="btn btn-primary btn-white dropdown-toggle col-sm-12" style="margin-left:0px;">
                    <span id="labelTrade_type">全部类型</span>
                    <i class="ace-icon fa fa-angle-down"></i>
                  </button>
                  <ul class="dropdown-menu col-sm-12" style="width:140px;min-width:140px;">
                    <li>
                      <a href="javascript:winFn.dropdown('#key_trade_type','','#labelTrade_type','全部类型');">全部类型</a>
                    </li>
                    <li>
                      <a href="javascript:winFn.dropdown('#key_trade_type','1','#labelTrade_type','微信支付');">微信支付</a>
                    </li>
                    <li>
                      <a href="javascript:winFn.dropdown('#key_trade_type','2','#labelTrade_type','积分支付');">积分支付</a>
                    </li>
                  </ul>
                  <input id="key_trade_type" type="hidden"/>
                </span>
              </td>
            </tr>
            <tr height="50px">
              <td colspan="4" permission='financial_details_btn_listData' style="display:none;">
                <div style="display:flex;flex-direction:row;align-items:center;justify-content:space-between">
                  <span>交易时间</span>
                  <input type="text" id="key_pay_date_start" placeholder="起始日期时间" readonly class="form-control search-query" maxlength="19" style="width:144px;cursor:pointer" title="请选择付款时间起始时间"/>
                  <i class='fa fa-exchange'></i>
                  <input type="text" id="key_pay_date_end" placeholder="结束日期时间" readonly class="form-control search-query" maxlength="19" style="width:144px;cursor:pointer" title="请选择付款时间结束时间"/>
                </div>
              </td>
              <td permission='financial_details_btn_listData' style="padding:0 6px;display:none" class="hidden-480">
                支付状态
              </td>
              <td permission='financial_details_btn_listData' style="display:none" class="hidden-480">
                <span class="input-group-btn">
                  <button data-toggle="dropdown" class="btn btn-primary btn-white dropdown-toggle col-sm-12" style="margin-left:0px;">
                    <span id="labelSearch_status">全部状态</span>
                    <i class="ace-icon fa fa-angle-down"></i>
                  </button>
                  <ul class="dropdown-menu col-sm-12" style="width:140px;min-width:140px;">
                    <li>
                      <a href="javascript:winFn.dropdown('#key_status','','#labelSearch_status','全部状态');">全部状态</a>
                    </li>
                    <li>
                      <a href="javascript:winFn.dropdown('#key_status','1','#labelSearch_status','已支付');">已支付</a>
                    </li>
                    <li>
                      <a href="javascript:winFn.dropdown('#key_status','0','#labelSearch_status','未支付');">未支付</a>
                    </li>
                  </ul>
                  <input id="key_status" type="hidden"/>
                </span>
              </td>
              <td permission='financial_details_btn_listData' style="padding:0 6px;display:none" class="hidden-480">
                购买类型
              </td>
              <td permission='financial_details_btn_listData' style="display:none" class="hidden-480">
                <span class="input-group-btn">
                  <button data-toggle="dropdown" class="btn btn-primary btn-white dropdown-toggle col-sm-12" id="btn_buyer_type" style="margin-left:0px;">
                    <span id="labelSearch_type">类型全部</span>
                    <i class="ace-icon fa fa-angle-down"></i>
                  </button>
                  <ul class="dropdown-menu col-sm-12" style="width:140px;min-width:140px;">
                    <li>
                      <a href="javascript:winFn.dropdown('#key_type','','#labelSearch_type','类型全部');">类型全部</a>
                    </li>
                    <li>
                      <a href="javascript:winFn.dropdown('#key_type','1','#labelSearch_type','消费者购买');">消费者购买</a>
                    </li>
                    <li>
                      <a href="javascript:winFn.dropdown('#key_type','2','#labelSearch_type','门店采购');">门店采购</a>
                    </li>
                    <li>
                      <a href="javascript:winFn.dropdown('#key_type','3','#labelSearch_type','区代采购');">区代采购</a>
                    </li>
                  </ul>
                  <input id="key_type" type="hidden"/>
                </span>
              </td>
              <td permission='financial_details_btn_listData' style="display:none">
                <div class="input-group">
                  <span class="input-group-btn"><button type="button" class="btn btn-inverse btn-white" id="btnSearch" title="搜索查询"><span class="ace-icon fa fa-search bigger-110"></span>搜索</button></span>
                </div>
              </td>
              <td permission='financial_details_btn_listData' style="display:none" class="hidden-480">
                <div class="input-group">
                  <span class="input-group-btn"><button type="button" class="btn btn-inverse btn-white" id="btnReset" title="重置清空搜索关键字"><span class="ace-icon fa fa-undo bigger-110"></span>重置</button></span>
                </div>
              </td>
              <td permission='financial_details_btn_export' style="display:none;" class="hidden-480">
                <div class="input-group">
                  <span class="input-group-btn"><button type="button" class="btn btn-inverse btn-white" id="btnExport" title="导出当前全部数据"><span class="ace-icon fa fa-upload bigger-110"></span>导出</button></span>
                </div>
              </td>
              <td permission='financial_details_btn_area' style="display:none;" class="hidden-480">
                <div class="input-group">
                  <span class="input-group-btn"><button type="button" class="btn btn-inverse btn-white" id="btnArea" title="获取行政区域"><span class="ace-icon fa fa-map-marker bigger-110"></span>区域</button></span>
                </div>
              </td>
            </tr>
          </table>
          <div class="hidden-480 pull-right tableTools-container" permission='financial_details_btn_listData' style="display:none;margin-bottom:2px"></div>
        </div>
        <div class="space-2"></div>
        <div class="profile-contact-links align-left" style="padding:10px;font-weight:600;">
          <span id="orderMoney" style="color:#00a0e9;"></span>
          <span id="orderPaidMoney" style="color:#F56C6C;margin-left:30px;"></span>
          <span id="orderUnpaidMoney" style="color:#909399;margin-left:30px;"></span>
        </div>
        <div class="space-2"></div>
        <table id="tableListFinancialDetails" class="table table-striped table-bordered table-hover" style="table-layout: fixed;">
          <tbody>
            <tr>
              <td style="text-align:center;height:37px">正在加载……</td>
            </tr>
          </tbody>
        </table>
      </div>
    </div>
  </div>
</div>
<div id="divKeyColumns" style="display:none;padding:1px 0px;"></div>
<div style="display:none;">
  <input type="hidden" id="financial_details_btn_listData"/>
  <input type="hidden" id="financial_details_row_queryById"/>
</div>
<div id="div_batch_tree" style="display:none;padding-top:2px">
  <ul id="ulBatchTree" class="ztree">
    <li><span>正在加载……</span></li>
  </ul>
</div>
<script src="js/decimal.js"></script>
<script type="text/javascript">
  ;(function($){
    var tableDom = '#tableListFinancialDetails';
    var urlRoute = '/financialDetails/';/*请求controller层的url*/
    var getList = urlRoute + 'listData';/*获取数据列表*/
    var getExport = urlRoute + 'getDataExport';/*获取导出的数据*/
    var urlArea = urlRoute + 'getAreaTree';/*获取行政区域列表*/
    var areaJson = null;
    var batchTreeObj = null;
    var batchTreeDom = '#ulBatchTree';
    var batchTreeConfig = {
      view : zTreeOpts.view(),
      data : zTreeOpts.data(),
      async : zTreeOpts.async({
        url : urlArea,
        method : 'GET',
        tips : true
      }),
      callback : {
        onClick : function(event,treeId,node){},
        beforeAsync : function(treeId,node){
          if(node == undefined){
            self.layerIndex = layerFn.loading('正在处理……');
          }
        },
        onAsyncSuccess : function(event,treeId,node,data){
          if(node == undefined){
            layerFn.closeIndex(self.layerIndex);
            thisPage.batchHandler();
          }
        },
        onAsyncError : function(event,treeId,node){
          if(node == undefined){}//此时ztree节点尚未生成
          layerFn.alert('连接服务器失败',AppKey.code.code199);
        },
        beforeClick : function(treeId,node,clickFlag){
          var end = node.grade < 4;
          if(end){
            self.areaText = zTreeOpts.getPath(node);
            areaJson = zTreeOpts.getNodeData(node);
          }else{
            layerFn.alert('仅支持区县级',AppKey.code.code199);
          }
          return end;//true时点击选中文本
        }
      }
    };
    var thisTable = null;
    thisPage = {
      init : function(){
        this.initTable();
        this.initDom();
        this.addEvent();
      },
      initDom : function(){
        laydate.render({
          elem: '#key_pay_date_start',//指定元素
          format : 'yyyy-MM-dd',/*格式*/
          showBottom : false,/*是否显示底部栏*/
          type: 'date'/*格式,datetime|date|time*/
        });
        laydate.render({
          elem: '#key_pay_date_end',//指定元素
          format : 'yyyy-MM-dd',/*格式*/
          showBottom : false,/*是否显示底部栏*/
          type: 'date'/*格式,datetime|date|time*/
        });
      },
      addEvent: function(){
        $(tableDom +' tbody').on('dblclick','td:not(:first-child,:last-child)',function(){//除去每行的第一个和最后一个单元格均可双击事件
          if(verifyFn.inputRequired('#financial_details_row_edit')){
            return;
          }
          thisPage.trDblclick(thisTable.row($(this).parent()).data());
        });
        //搜索按钮
        $('#btnSearch').on('click', function(){
          thisPage.search();
        });
        //导出
        $('#btnExport').on('click', function(){
          var params = {};
          params["payeeAccount"] = winFn.getDomValue('#key_payee_account');
          params["buyerAccount"] = winFn.getDomValue('#key_buyer_account');
          params["transaction_id"] = winFn.getDomValue('#key_transaction_id');
          params["out_trade_no"] = winFn.getDomValue('#key_out_trade_no');
          params["status"] = winFn.getDomValue('#key_status');
          params["buyer_type"] = winFn.getDomValue('#key_type');
          params["trade_type"] = winFn.getDomValue('#key_trade_type');
          params["date_start"] = winFn.getDomValue('#key_pay_date_start') ? new Date(winFn.getDomValue('#key_pay_date_start').replace(new RegExp("-","gm"),"/")).getTime()/1000 : '';
          params["date_end"] = winFn.getDomValue('#key_pay_date_end') ? new Date(winFn.getDomValue('#key_pay_date_end').replace(new RegExp("-","gm"),"/")).getTime()/1000 : '';
          var urlParams = '';
          for(k in params){
            var v = params[k];
            if(v != null){
              if(urlParams != ''){
                urlParams += '&' + k + '=' + v;
              }else{
                urlParams += k + '=' + v;
              }
            }
          }
          var zIndexLayer = layerFn.confirm('确定要导出当前的全部数据吗？处理完成将会自动下载，请等待……',function(){
            winFn.getPageHashToken(getExport+'?'+urlParams);
          });
          $('#layui-layer' + zIndexLayer + ' a.layui-layer-btn0').text('导出');
        });
        //重置按钮
        $('#btnReset').on('click', function(){
          $('#key_payee_account').val('');
          $('#key_buyer_account').val('');
          $('#key_transaction_id').val('');
          $('#key_out_trade_no').val('');
          $('#key_pay_date_start').val('');
          $('#key_pay_date_end').val('');
          $('#labelSearch_status').text('全部状态');
          $('#key_status').val('');
          $('#labelSearch_type').text('类型全部');
          $('#key_type').val('');
          $('#labelTrade_type').text('全部类型');
          $('#key_trade_type').val('');
          areaJson = null;//置空
          thisPage.AreaHtml('区域');
          if(batchTreeObj != null){
            batchTreeObj.cancelSelectedNode();//取消选中
          }
        });
        //按钮组-自定义显示列
        $('#iconColumn').parent().parent().remove();
        //按钮组-搜索
        $('#iconRefresh').parent().parent().on('click', function(){
          thisPage.search();
        });
        //获取区域数据用于构建树形
        $('#btnArea').on('click', function(){
          var value = winFn.getDomValue('#key_type');
          if(value == null){
            layerFn.alertCallback('请先选择购买类型！',function(){
              $('#btn_buyer_type').trigger('click');
            });
            return;
          }
          authHandler('order_info_btn_area',function(){
            batchTreeObj = $.fn.zTree.init($(batchTreeDom),batchTreeConfig);
          });
        });
      },
      batchHandler : function(){
        var zIndexLayer = layerFn.addOrEdit('选择行政区域','#div_batch_tree',['510px','450px'],function(layerIndex){
          thisPage.AreaHtml(self.areaText);
          layerFn.closeIndex(layerIndex);
        },'<label style="color:#f1a02f;">重置</label>',function(){
          areaJson = null;//置空
          thisPage.AreaHtml('区域');
          batchTreeObj.cancelSelectedNode();//取消选中
        });
        $('#layui-layer' + zIndexLayer + ' a.layui-layer-btn0').text('确定');
      },
      AreaHtml : function(text){
        $('#btnArea').html('<span class="ace-icon fa fa-map-marker bigger-110"></span>'+text);
      },
      /**获取已选中的主键集合,用法:var kids = thisPage.getKeyIds();if(kids == null){layerFn.alert('请选择要操作的数据', AppKey.code.code199);return;}*/
      getKeyIds : function(){
        var arrays = thisTable.rows({selected : true}).data();//获取已勾选的数据行
        if(arrays.length == 0){
          return null;
        }
        var kids = '';
        for(var i = 0; i < arrays.length; i++){
          var value = arrays[i].kid;
          if(value != ''){
            if(kids.length > 0) kids += ",";
            kids += value;
          }
        }
        return kids;
      },
      initTable : function(){
        var optsVisible = getOptsVisible('financial_details_row');//确定是否要显示操作选项,若是多个按钮权限时以逗号,隔开
        var aoColumns = [];
        aoColumns.push({
          data : "buyer",
          sortable : true,
          title : "购买人信息"
        });
        aoColumns.push({
          data : "payee",
          sortable : true,
          title : "收款人信息"
        });
        aoColumns.push({
          data : "orderType",
          sortable : false,
          title : "订单类型",
          render : function(value){
            if(value == 1){
              return "微信订单";
            }else if(value == 2){
              return "积分订单";
            }else{
              return "";
            }
          }
        });
        aoColumns.push({
          data : "buyer_type",
          sortable : false,
          title : "购买类型",
          render : function(value){
            if(value == 1){
              return "消费者购买";
            }else if(value == 2){
              return "门店采购";
            }else if(value == 3){
              return "区代采购";
            }else{
              return "";
            }
          }
        });
        aoColumns.push({
          data : "out_trade_no",
          sortable : false,
          title : "订单商品信息"
        });
        aoColumns.push({
          data : "",
          sortable : false,
          title : "订单分成信息"
        });
        aoColumns.push({
          data : "total_fee",
          sortable : true,
          title : "支付金额",
          render : function(value){
            if(value){
              return '￥'+Decimal(value).toFixed(2);
            }else{
              return "";
            }
          }
        });
        aoColumns.push({
          data : "status",
          sortable : true,
          title : "支付状态",
          render : function(value){
            if(value == 0){
              return "未支付";
            }else if(value == 1){
              return "已支付";
            }else{
              return "";
            }
          }
        });
        aoColumns.push({
          data : "add_date",
          sortable : true,
          title : "下单时间",
          width: "128px",
          render : function(value){
            if(value){
              return winFn.formatDate(value,true);/*宽度width: "121px",*/
            }else{
              return "";
            }
          }
        });
        aoColumns.push({
          data : "pay_date",
          sortable : true,
          title : "付款时间",
          width: "128px",
          render : function(value){
            if(value){
              return winFn.formatDate(value,true);/*宽度width: "121px",*/
            }else{
              return "";
            }
          }
        });
        if(optsVisible){
          aoColumns.push({
            data : "_kid_",
            width : "75px",
            title : "<label style='color:#000;margin-left:6px;' title='单行操作'>操作选项</label>",/*此处的字‘操作选项’请勿修改,此处的文字还有其它用途*/
            sortable : false
          });
        }
        var width = $(".page-content-area").outerWidth();
        var scrollX = false;
        var columnDefs = [];
        columnDefs.push({
          targets: [0,1],
          width:'180px'
        });
        columnDefs.push({
          targets: [2,3],
          width:'90px'
        });
        columnDefs.push({
          targets: [5],
          width:'200px'
        });
        columnDefs.push({
          targets: [6],
          width:'110px'
        });
        columnDefs.push({
          targets: [7],
          width:'80px'
        });
        columnDefs.push({
          targets: [8,9],
          width:'150px'
        });
        if(width < 1530) {
          columnDefs.push({
            targets: [4],
            width:'300px'
          })
          scrollX = true;
        }
        if(optsVisible){//是否来显示某列
          columnDefs.push({
            targets : -1,
            render : function(value,type,row,meta){
              return "";
            }
          });
        }
        columnDefs.push({
          targets : [0,1,2,3,4,5,6,7,8,9],
          render : function(value,type,row,meta){
            return pageDataTable.formatColumn(value);
          }
        });
        columnDefs.push({
          targets : [2,3,6,7,8,9],
          className: "text-center"
        });
        columnDefs.push({
          visible : false,//列的隐藏显示
          targets : []//指定列索引
        });
        thisTable = pageDataTable.initDataTable({
          tableDom : tableDom,
          sAjaxSource : getList,
          fnServerParams : function(params){
            params.push(
              {"name":"payeeAccount","value":winFn.getDomValue('#key_payee_account')},
              {"name":"buyerAccount","value":winFn.getDomValue('#key_buyer_account')},
              {"name":"transaction_id","value":winFn.getDomValue('#key_transaction_id')},
              {"name":"out_trade_no","value":winFn.getDomValue('#key_out_trade_no')},
              {"name":"status","value":winFn.getDomValue('#key_status')},
              {"name":"buyer_type","value":winFn.getDomValue('#key_type')},
              {"name":"trade_type","value":winFn.getDomValue('#key_trade_type')},
              {"name":"date_start","value":winFn.getDomValue('#key_pay_date_start') ? new Date(winFn.getDomValue('#key_pay_date_start').replace(new RegExp("-","gm"),"/")).getTime()/1000 : ''},
              {"name":"date_end","value":winFn.getDomValue('#key_pay_date_end') ? new Date(winFn.getDomValue('#key_pay_date_end').replace(new RegExp("-","gm"),"/")).getTime()/1000 : ''}
            );
            if(areaJson != null){
              params.push(
                {"name":"areaData","value":JSON.stringify(areaJson)}
              );
            }
          },
          scrollX : scrollX,
          scrollY : (winFn.fnGetHeight() * 0.7) + 'px',
          aoColumns : aoColumns,
          columnDefs : columnDefs,
          complete : function(settings,data){},
          selected : function(selected){
            if(selected){
              //$('#btnDel').removeAttr('disabled');//默认在该button添加属性disabled="disabled"
            }else{
              //$('#btnDel').attr('disabled','disabled');
            }
          },
          rowCallback: function(row,data,index){
            var payeeHtml = "<div class=\"\" style='height:100%;display:flex;flex-direction:column;justify-content:flex-start;padding:0 5px;font-size:12px;'>" +
              "<span style='border-bottom:1px dashed #dedddd;padding:5px;'>账号："+(data.payee || '空')+"</span>" +
              "<span style='border-bottom:1px dashed #dedddd;padding:5px;'>姓名："+(data.payeeName || '空')+"</span>" +
              "<span style='border-bottom:1px dashed #dedddd;padding:5px;word-break:normal; width:auto; display:block; white-space:pre-wrap;word-wrap : break-word ;overflow: hidden;'>昵称："+(data.payeeNick || '空')+"</span></div>";
            var buyerHtml = "<div class=\"\" style='height:100%;display:flex;flex-direction:column;justify-content:flex-start;padding:0 5px;font-size:12px;'>" +
              "<span style='border-bottom:1px dashed #dedddd;padding:5px;'>账号："+(data.buyer || '空')+"</span>" +
              "<span style='border-bottom:1px dashed #dedddd;padding:5px;'>姓名："+(data.buyerName || '空')+"</span>" +
              "<span style='border-bottom:1px dashed #dedddd;padding:5px;word-break:normal; width:auto; display:block; white-space:pre-wrap;word-wrap : break-word ;overflow: hidden;'>昵称："+(data.buyerNick || '空')+"</span></div>";
            $('td', row).eq(0).css('verticalAlign', 'center').html(buyerHtml);
            $('td', row).eq(1).css('verticalAlign', 'center').html(payeeHtml);
            if(data.details && Object.keys(data.details).length > 0){
              var goodList = [];
              var goodNameList = data.details.contract_name ? data.details.contract_name.split(",") : [];
              var goodFeeList = data.details.item_fee ? data.details.item_fee.split(",") : [];
              var goodThumbList = data.details.thumbnail ? data.details.thumbnail.split(",") : [];
              var goodTotalList = data.details.total ? data.details.total.split(",") : [];
              var goodBottlesList = data.details.bottles ? data.details.bottles.split(",") : [];
              for (var x = 0; x < goodNameList.length; x++) {
                var goodName = goodNameList[x];
                var itemFee = goodFeeList[x];
                var thumbnail = goodThumbList[x];
                var total = goodTotalList[x];
                var bottles = goodBottlesList[x];
                var obj = {};
                obj.goodName = goodName || '';
                obj.itemFee = itemFee || 0;
                obj.thumbnail = thumbnail;
                obj.total = total || 0;
                obj.bottles = bottles || 0;
                goodList.push(obj);
              }
              var goodListHtml = "<div id=\"orderGoodList"+index+"\" class=\"orderGoodList\" style='padding:0 5px;font-size:12px;'><p style='font-size:13px;'><span style='color:#999;'>交易单号：</span><span style='font-weight:600;'>"+(data.transaction_id || '无')+"</span></p>" +
                "<p style='font-size:13px;'><span style='color:#999;'>商户单号：</span><span style='font-weight:600;'>"+data.out_trade_no+"</span></p>" +
                "</div>";
              var gainerListHtml = "<div id=\"orderGainerList"+index+"\" class=\"\" style='height:100%;display:flex;flex-direction:column;justify-content:flex-start;padding:0 5px;font-size:12px;'>" +
                "</div>";
              $('td', row).eq(4).css('verticalAlign', 'top').html(goodListHtml);
              $('td', row).eq(5).css('verticalAlign', 'center').html(gainerListHtml);
              var gainerList = [];
              var scoreList = data.details.score ? data.details.score.split(",") : [];
              var realNameList = data.details.realName ? data.details.realName.split("W_w_xin_Suo_Fa_Com") : [];
              var userNameList = data.details.user_name ? data.details.user_name.split(",") : [];
              var typeList = data.details.type ? data.details.type.split(",") : [];
              for (var y = 0; y < scoreList.length; y++) {
                var score = scoreList[y];
                var realName = realNameList[y];
                var user_name = userNameList[y];
                var type = typeList[y];
                if(type == 1){
                  type = '省';
                }else if(type == 2){
                  type = '市';
                }else if(type == 3){
                  type = '区';
                }else if(type == 4){
                  type = '店';
                }else if(type == 5){
                  type = '推';
                }else if(type == 6){
                  type = '事';
                }
                var gainerObj = {};
                gainerObj.score = score || 0;
                gainerObj.realName = realName || '';
                gainerObj.user_name = user_name  || '';
                gainerObj.type = type  || '';
                gainerList.push(gainerObj);
              }
              //要求浏览器在下次重绘之前调用指定的回调函数更新动画
              window.requestAnimationFrame(function() {
                goodList.forEach(function(item){
                  var goodHtml = "<div class=\"\" style=\"display:flex;border-top:1px dashed #dedddd;padding:5px;\"><div><img style=\"width:40px;height:40px;\" src=\" "+(item.thumbnail ? webFiles + item.thumbnail : 'img/logo.png')+"\" alt=\"商品图片\" class=\"img-thumbnail img-responsive center-block\"></div>" +
                    "<div style='display:flex;flex-direction:column;justify-content:space-between;margin-left:15px;padding:1px 0;'><span>"+item.goodName+" * "+ item.total+(item.bottles != 0 ? '件 （'+item.bottles+'瓶/件）' : '瓶')+"</span><span>￥"+Decimal(item.itemFee).toFixed(2)+"</span></div>" +
                    "</div>";
                  $("#orderGoodList"+index).append(goodHtml);
                })
                gainerList.forEach(function(item){
                  var gainerHtml = "<div style='border-bottom:1px dashed #dedddd;padding:5px;'><div>账号："+ item.user_name +"</div><div>"+(item.type ? "["+item.type+"]" : '')+" "+item.realName+"：￥"+Decimal(item.score).toFixed(2)+"</div></div>";
                  $("#orderGainerList"+index).append(gainerHtml);
                })
              });
            }
          },
          drawCallback:function(settings){
            var listMoney = {};
            if(settings.jqXHR.responseJSON){
              listMoney = settings.jqXHR.responseJSON.attach || {};
            }
            if (Object.keys(listMoney).length > 0) {
              var orderMoney = listMoney.orderMoney || 0;
              var orderPaidMoney = listMoney.orderPaidMoney || 0;
              var orderUnpaidMoney = listMoney.orderUnpaidMoney || 0;
              $("#orderMoney").html('订单金额：'+ orderMoney + '');
              $("#orderPaidMoney").html('已支付金额：'+ orderPaidMoney +'');
              $("#orderUnpaidMoney").html('未支付金额：'+ orderUnpaidMoney +'');
            }
          },
          footer: function(data,start,end,display){
            if(data.length < 1){
              return;
            }
            var pageTotalFee = 0,pageTotalPaid = 0,pageTotalUnpaid = 0;
            data.forEach(function(value) {
              pageTotalFee = Decimal(pageTotalFee).add(value.total_fee).toFixed(2);
              if(value.status == 0){
                pageTotalUnpaid = Decimal(pageTotalUnpaid).add(value.total_fee).toFixed(2);
              }else if(value.status == 1){
                pageTotalPaid = Decimal(pageTotalPaid).add(value.total_fee).toFixed(2);
              }
            })
            var html = '<tr><td colspan="10" style="text-align:center;height:50px;">当前页合计：<span style="">订单金额：￥'+pageTotalFee+'</span>' +
              '<span style="margin-left:30px;">已支付金额：￥'+pageTotalPaid+'</span>' +
              '<span style="margin-left:30px;">未支付金额：￥'+pageTotalUnpaid+'</span></td></tr>';
            $(tableDom +' tbody').append(html);
          }
        });
        // // 定义自定义渲染函数
        // $.fn.dataTableExt.oApi._fnCallbackFunctions.aiDisplayMaster = function (oSettings, oData) {
        //   var rowIndex = oSettings.nTr; // 获取当前行的索引
        //   var imgUrl = 'img/logo.png'; // 替换为你的图片路径
        //   var text = '<div><img src="' + imgUrl + '" alt="Image"></div><div>' + oData.pay_date + '</div>'; // 替换为你的文本内容
        //   return text;
        // };
        pageDataTable.buttons(thisTable);
        pageDataTable.action(thisTable);
        pageDataTable.select(thisTable, tableDom);
        pageDataTable.tooltip();
      },
      //双击事件
      trDblclick: function(data){},
      search: function(){
        if(verifyFn.inputCheck('#financial_details_btn_listData','没有操作权限')) return;
        $(tableDom + '_wrapper table input[type=checkbox]').prop('checked',false);
        thisTable.draw();
      },
      //需要时或为空时才去请求,减轻服务器查询,用法:thisPage.getGoods_orders(function(list){});参考项目 wine-frontend/src/main/resources/static/activity.html的getGoods方法
      getGoods_orders : function(callbak){
        if(listGoods_order == null){//定义全局的 var listGoods_order = null;
          layerFn.queryGetHint(urlQueryGoods_order,{},function(data){
            if(AppKey.code.code200 == data.code){
              listGoods_order = data.data;
              callbak(listGoods_order);
            }
          });
        }else{
          callbak(listGoods_order);
        }
      },
      //查看隐藏部分是全部内容,用法 render : function(value,type,row,meta){return thisPage.rowColumnView(value);}
      rowColumnView : function(value){
        if(value == null || value == undefined || value == '') return '';
        value = typeof value === 'string' ? value.replace(/</g, '&lt;').replace(/"/g, '&quot;') : value;//如果提示SyntaxError: expected expression, got '>'错误则注释掉即可
        var len = value.length;
        if(len > 30){
          return "<a href='javascript:layerFn.viewValue(\""+value+"\",\"430px\");' title='点击查看详情' style='outline:none;text-decoration: none;'>"+value.substring(0,30)+"…</a>";
        }else{
          return value;
        }
      },
      complete: function(data,index,search){
        try{
          if(index){
            layerFn.closeIndex(index);
          }
          if(search){
            thisPage.search();
          }
          if(data){
            layerFn.handleResult(data.msg,data.code);
          }
        }catch(e){}
      }
    };
    thisPage.init();
    $('script').remove();
  })(jQuery);
</script>